package com.breakfast.fun.data.entity.user.address;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by hp on 2016/9/8.
 */
public class Address {

    /**
     * total : 2
     * pageTotal : 2
     * data : [{"id":4500,"accountId":5407,"mobile":"18359928629","consignee":"步步错","provinceId":0,"cityId":1,"cityName":"福州市","areaId":12,"areaName":"台江区-金融街万达","builderId":337,"builderName":"申发大厦","detail":"好18145181484881","address":"申发大厦-好18145181484881","phone":"15054557445","isDefault":"n","floorNo":"3楼","addTime":"2016-08-25 17:53:46"},{"id":2785,"accountId":5407,"mobile":"18359928629","consignee":"余凯","provinceId":0,"cityId":1,"cityName":"福州市","areaId":44,"areaName":"仓山区-山亚创业园","builderId":450,"builderName":"山亚创业园","detail":"车库咖啡三楼早范","address":"山亚创业园-车库咖啡三楼早范","phone":"18359928629","isDefault":"n","floorNo":"3楼","addTime":"2016-08-01 20:57:01"}]
     * msg : 查询成功
     * success : true
     */

    private int total;
    private int pageTotal;
    private String msg;
    private boolean success;
    /**
     * id : 4500
     * accountId : 5407
     * mobile : 18359928629
     * consignee : 步步错
     * provinceId : 0
     * cityId : 1
     * cityName : 福州市
     * areaId : 12
     * areaName : 台江区-金融街万达
     * builderId : 337
     * builderName : 申发大厦
     * detail : 好18145181484881
     * address : 申发大厦-好18145181484881
     * phone : 15054557445
     * isDefault : n
     * floorNo : 3楼
     * addTime : 2016-08-25 17:53:46
     */

    private List<AddressData> data;

    public static Address objectFromData(String str) {

        return new Gson().fromJson(str, Address.class);
    }

    public static List<Address> arrayAddressFromData(String str) {

        Type listType = new TypeToken<ArrayList<Address>>() {
        }.getType();

        return new Gson().fromJson(str, listType);
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public int getPageTotal() {
        return pageTotal;
    }

    public void setPageTotal(int pageTotal) {
        this.pageTotal = pageTotal;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public List<AddressData> getData() {
        return data;
    }

    public void setData(List<AddressData> data) {
        this.data = data;
    }

}
